var UtilClass = UtilClass ||
    (function ($) {
        var utilClass = {};
        /**
         * 对话框
         */
        function LayerDialog(options){
            options = options || {};
            this.type = options.type || 2,
                this.title = options.title || "Expect-X对话框";
            this.content = options.content || "http://expect-x.net";
            this.size = options.size || [($(window).width()-25)+'px',($(window).height()-25)+'px'];
            this.btns = options.btns || ['提交','重置'];
            this.fix = options.fix || false;
            this.maxmin = options.maxmin || true;
            this.shade = options.shade || 0.4;


        };
        LayerDialog.prototype.layerShow=function(){
            if(typeof (layer)=='undefined'){
                alert("请注入layer");
                return;
            }
            layer.open({
                type:this.type,
                title:this.title,
                area:this.size,
                fix:this.fix,
                maxmin:this.maxmin,
                shade:this.shade,
                content:this.content,
                btn:this.btns,
                yes:function (index,layero) {
                    formSubmit(layero);
                },
                btn2: function(index,layero){
                    formReset(layero);
                    return false;
                }
            });
        }


        function formSubmit(layero){
            var childrenFrame=window[layero.find('iframe')[0]['name']];
            childrenFrame.createSubmit();
        }
        function formReset(layero){
            var childrenFrame=window[layero.find('iframe')[0]['name']];
            childrenFrame.createReset();
        }

        // ================================
        utilClass.LayerDialog = LayerDialog;
        return utilClass;
    })(jQuery)